home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / usr / lib / pm-utils / module.d / tuxonice < prev    next >
Text File  |  2008-10-15  |  1KB  |  49 lines

  1. #!/bin/sh
  2.  
  3. export TUXONICE_LOC
  4. # TODO tuxonice supports all sorts of knobs to twiddle. Since this should be as
  5. # simple as possible, it does not provide a mechanism for twiddling those knobs.
  6. # If you need more customization than this file has, consider using a hook to
  7. # set the appropriate values.
  8.  
  9. # more locations might be nice
  10. for loc in "/sys/power/tuxonice" "/sys/power/suspend2"; do
  11.     [ -d "${loc}" ] && { TUXONICE_LOC="${loc}"; break; }
  12. done 
  13.  
  14. check_suspend()
  15. {
  16.     grep -q mem /sys/power/state || [ -c /dev/pmu ]
  17. }
  18.  
  19. do_suspend()
  20. {
  21.     if grep -q mem /sys/power/state; then
  22.         echo -n "mem" > /sys/power/state
  23.     elif [ -c /dev/pmu ]; then
  24.         check_suspend_pmu && do_suspend_pmu
  25.     fi
  26. }
  27.  
  28. check_hibernate()
  29. {
  30.     [ -f "${TUXONICE_LOC}/do_hibernate" ]
  31. }
  32.  
  33. do_hibernate()
  34. {
  35.     echo 5 > "${TUXONICE_LOC}/powerdown_method"
  36.     echo anything > "${TUXONICE_LOC}/do_hibernate"
  37. }
  38.  
  39. check_suspend_hybrid()
  40. {
  41.     grep -q mem /sys/power/state && \
  42.     [ -f "${TUXONICE_LOC}/do_hibernate" ]
  43. }
  44. do_suspend_hybrid()
  45. {
  46.     echo 3 >"${TUXONICE_LOC}/powerdown_method"
  47.     echo anything >"${TUXONICE_LOC}/do_hibernate"
  48. }
  49.